package com.example.securityresource.controller;

import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/product")
public class UserController {

    @GetMapping("/list")
    public Object getCurrentUser(Authentication authentication) {
        List<String> result = new ArrayList<>();
        result.add("huawei");
        result.add("xiaomi");
        result.add("oppo");
        result.add("vivo");
        System.out.println(authentication.getPrincipal());
        return result;
    }
}
